using System;
using System.Collections.Generic;
using Agriculture.Domain;
using MediatR;

namespace Agriculture.Api.Read.Application.Command
{
    /// <summary>
    /// 药品订单查询命令
    /// </summary>
    public class MedicineOrderQuery : IRequest<MedicineOrderQueryResult>
    {
        /// <summary>
        /// 订单号或收货人（用于模糊查询）
        /// </summary>
        public string? OrderSearch { get; set; }

        /// <summary>
        /// 下单开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 下单结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 订单状态（0：全部，1：待发货，2：待收货，3：已收货）
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页大小
        /// </summary>
        public int PageSize { get; set; } = 10;
    }

    /// <summary>
    /// 药品订单查询结果
    /// </summary>
    public class MedicineOrderQueryResult
    {
        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public int TotalPages { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public int CurrentPage { get; set; }

        /// <summary>
        /// 药品订单列表
        /// </summary>
        public List<MedicineOrderDto> MedicineOrders { get; set; } = new List<MedicineOrderDto>();
    }

    /// <summary>
    /// 药品订单DTO
    /// </summary>
    public class MedicineOrderDto
    {
        /// <summary>
        /// 订单编号
        /// </summary>
        public string OrderNo { get; set; }

        /// <summary>
        /// 提交时间
        /// </summary>
        public DateTime SubmitTime { get; set; }

        /// <summary>
        /// 用户名/手机号
        /// </summary>
        public string UserPhone { get; set; }

        /// <summary>
        /// 收货人
        /// </summary>
        public string Receiver { get; set; }

        /// <summary>
        /// 订单金额
        /// </summary>
        public decimal OrderAmount { get; set; }

        /// <summary>
        /// 订单状态（待发货/待收货/已收货）
        /// </summary>
        public string Status { get; set; }
    }
} 